﻿<?php 
$w_new = '100'; 
$foto = 'foto.jpg'; 
$old = imageCreateFromJpeg("$foto"); 
$w = imageSX($old); 
$h = imageSY($old); 
$new = $h / $w; 
$h_new= $w_new * $new; 
$new = imageCreate($w_new, $h_new); 
$new = imagecreatetruecolor($w_new, $h_new); 
imageCopyResized($new, $old, 0, 0, 0, 0, $w_new, $h_new, $w, $h); 
imageJpeg($new,"","80"); 
?>